/*    */ package blockbuster.components.shape;
/*    */ 
/*    */ import blockbuster.emitter.BedrockParticle;
/*    */ import blockbuster.math.molang.expressions.MolangExpression;
/*    */ import com.google.gson.JsonArray;
/*    */ import com.google.gson.JsonElement;
/*    */ import com.google.gson.JsonPrimitive;
/*    */ import javax.vecmath.Tuple3d;
/*    */ import javax.vecmath.Vector3d;
/*    */ 
/*    */ public abstract class ShapeDirection
/*    */ {
/* 13 */   public static final ShapeDirection INWARDS = new Inwards(-1.0F);
/* 14 */   public static final ShapeDirection OUTWARDS = new Inwards(1.0F);
/*    */   
/*    */   public abstract void applyDirection(BedrockParticle paramBedrockParticle, double paramDouble1, double paramDouble2, double paramDouble3);
/*    */   
/*    */   public abstract JsonElement toJson();
/*    */   
/*    */   private static class Inwards
/*    */     extends ShapeDirection
/*    */   {
/*    */     private float factor;
/*    */     
/*    */     public Inwards(float factor) {
/* 26 */       this.factor = factor;
/*    */     }
/*    */ 
/*    */ 
/*    */     
/*    */     public void applyDirection(BedrockParticle particle, double x, double y, double z) {
/* 32 */       Vector3d vector = new Vector3d(particle.position);
/*    */       
/* 34 */       vector.sub((Tuple3d)new Vector3d(x, y, z));
/*    */       
/* 36 */       if (vector.length() <= 0.0D) {
/*    */         
/* 38 */         vector.set(0.0D, 0.0D, 0.0D);
/*    */       }
/*    */       else {
/*    */         
/* 42 */         vector.normalize();
/* 43 */         vector.scale(this.factor);
/*    */       } 
/*    */       
/* 46 */       particle.speed.set((Tuple3d)vector);
/*    */     }
/*    */ 
/*    */ 
/*    */     
/*    */     public JsonElement toJson() {
/* 52 */       return (JsonElement)new JsonPrimitive((this.factor < 0.0F) ? "inwards" : "outwards");
/*    */     }
/*    */   }
/*    */   
/*    */   public static class Vector
/*    */     extends ShapeDirection
/*    */   {
/*    */     public MolangExpression x;
/*    */     public MolangExpression y;
/*    */     public MolangExpression z;
/*    */     
/*    */     public Vector(MolangExpression x, MolangExpression y, MolangExpression z) {
/* 64 */       this.x = x;
/* 65 */       this.y = y;
/* 66 */       this.z = z;
/*    */     }
/*    */ 
/*    */ 
/*    */     
/*    */     public void applyDirection(BedrockParticle particle, double x, double y, double z) {
/* 72 */       particle.speed.set((float)this.x.get(), (float)this.y.get(), (float)this.z.get());
/*    */       
/* 74 */       if (particle.speed.length() <= 0.0F) {
/*    */         
/* 76 */         particle.speed.set(0.0F, 0.0F, 0.0F);
/*    */       }
/*    */       else {
/*    */         
/* 80 */         particle.speed.normalize();
/*    */       } 
/*    */     }
/*    */ 
/*    */ 
/*    */     
/*    */     public JsonElement toJson() {
/* 87 */       JsonArray array = new JsonArray();
/*    */       
/* 89 */       array.add(this.x.toJson());
/* 90 */       array.add(this.y.toJson());
/* 91 */       array.add(this.z.toJson());
/*    */       
/* 93 */       return (JsonElement)array;
/*    */     }
/*    */   }
/*    */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\blockbuster\components\shape\ShapeDirection.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */